using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.Configuration;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebControls;
using System.Collections.Generic;
using MSU_UserControls.MSUWS;
using System.Collections.Specialized;


namespace MSU_UserControls
{
    public class MSU_UserControl : System.Web.UI.UserControl
    {

        private MSU_UserControls.MSUWS.WSMSU wsmsu = null;

        protected MSU_UserControls.MSUWS.WSMSU WSMSU
        {
            get {
                if (wsmsu == null)
                {
                    wsmsu = new WSMSU();
                    /*wsmsu.Timeout = 99999;
                    wsmsu.Url = MSU_UserControls.Properties.Settings.Default.MSUWS;*/
                }
                return wsmsu; 
            }
        }

        #region Properties

        public MSU_User _msu_User
        {
            get 
            {
                if (Session["msu_User"] == null)
                    return null;
                else
                    return (MSU_User)Session["msu_User"]; 
            }
            set 
            { 
                Session["msu_User"] = value; 
            }
        }

        public MSU_Adm _msu_Adm
        {
            get
            {
                if (Session["msu_Adm"] == null)
                {
                    MSU_Adm adm = new MSU_Adm();

                    adm.AdPass = MSU_UserControls.Properties.Settings.Default.AdPass;
                    adm.AdUser = MSU_UserControls.Properties.Settings.Default.AdUser;
                    adm.MoodlePass = MSU_UserControls.Properties.Settings.Default.MoodlePass;
                    adm.MoodleUser = MSU_UserControls.Properties.Settings.Default.MoodleUser;
                    adm.LdapPath1 = MSU_UserControls.Properties.Settings.Default.LdapPath1;
                    adm.LdapPath2 = MSU_UserControls.Properties.Settings.Default.LdapPath2;
                    Session["msu_Adm"] = adm;
                    return adm;
                }
                else
                    return ((MSU_Adm)Session["msu_Adm"]);
            }           
        }

        #endregion
    }
}
